from fastapi import APIRouter, FastAPI
from .controller.speech_controller import speechController
from .controller.websocket_controller import websocket_speech_recognize
from .controller.speech_api_controller import speechApiController
from .controller.speech_client_controller import speechClientController

def include_speech_routers(app: FastAPI):
    """
    注册语音识别相关路由
    """
    # 注册系统用户REST API路由（需要JWT认证）
    app.include_router(speechController, tags=["语音识别-系统用户"])
    
    # 注册客户端用户管理路由（管理员接口，需要JWT认证）
    app.include_router(speechClientController, tags=["语音识别-客户端用户管理"])
    
    # 注册客户端API路由（对外API，使用API Key认证）
    app.include_router(speechApiController, tags=["语音识别-客户端API"])
    
    # 注册WebSocket路由
    app.websocket("/ws/speech/recognize")(websocket_speech_recognize)
    
    # 可以添加更多特定的WebSocket端点
    @app.websocket("/ws/speech/recognize/{session_id}")
    async def websocket_speech_with_session(websocket, session_id: str):
        """带会话ID的WebSocket端点"""
        await websocket_speech_recognize(websocket, session_id=session_id)

__all__ = ["include_speech_routers"] 